package com.gupaoedu.security.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Auther: 肖冬
 * @Date: 2020/10/12 14:25
 * @Description:
 */
@Controller
public class PrincipalController {

    @GetMapping("/test")
    @ResponseBody
    public String test() {
        // SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        return "test:" + SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
